package com.liws.helloUpload.model;

import lombok.Data;

import java.io.Serializable;
import java.util.Map;

/**
 * @Author: liweisheng
 * @Dcscription:
 * @Date: 2022/1/5 10:01
 */

@Data
public class BaseResult implements Serializable {
    public int status;
    public String message;
    public static final int STATUS_SUCCESS=200;
    public static final int STATUS_FAIL=500;

    public static BaseResult success(){
        return BaseResult.createResult(STATUS_SUCCESS,"成功");
    }

    public static BaseResult success(String message){

        return BaseResult.createResult(STATUS_SUCCESS,message);
    }




    public static BaseResult fail() {
        return BaseResult.createResult(STATUS_FAIL,"失败");
    }
    public static BaseResult fail(String message){
        return BaseResult.createResult(STATUS_FAIL,message);
    }

    public static BaseResult fail(int status,String message){

        return BaseResult.createResult(status,message);
    }

    public int getStatus() {
        return status;
    }


    public void setStatus(int status) {
        this.status = status;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    private static BaseResult createResult(int status, String message){
        BaseResult baseResult = new BaseResult();
        baseResult.setStatus(status);
        baseResult.setMessage(message);
        return baseResult;
    }


}
